<?php

declare(strict_types=1);

namespace App\Controller;

use App\Request\GetCodeForSignUpRequest;
use App\Service\MailService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;

class MailController extends AbstractController
{
    /**
     * @var MailService
     */
    #[Inject]
    public MailService $mailService;

    public function index(RequestInterface $request, ResponseInterface $response)
    {
        return $response->raw('Hello Hyperf!');
    }

    public function getCode(GetCodeForSignUpRequest $getCodeForSignUpRequest) {
        //...
        $mail = $this->request->input('email');
        $this->mailService->getCode($mail);
        return $this->response->success();
    }

}
